package com.douqu.game.main.service;

import com.douqu.game.core.database.model.GMLogModel;
import com.douqu.game.core.database.model.GMModel;
import com.douqu.game.core.database.model.OrderRecordModel;
import com.douqu.game.main.database.mapper.read.ReadGMMapper;
import com.douqu.game.main.database.mapper.write.WriteGMLogMapper;
import com.douqu.game.main.database.mapper.write.WriteGMMapper;
import com.douqu.game.main.database.mapper.write.WriteOrderRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by bean on 2017/8/12.
 */
@Service
public class GMServiceImpl implements GMService {

    @Autowired
    private ReadGMMapper readGMMapper;

    @Autowired
    private WriteGMMapper writeGMMapper;

    @Autowired
    private WriteGMLogMapper writeGMLogMapper;

    @Autowired
    private WriteOrderRecordMapper writeOrderRecordMapper;


    @Override
    public int create(GMModel gmModel) {
        return writeGMMapper.insert(gmModel);
    }

    @Override
    public int openOrClose(int id) {
        return writeGMMapper.openOrClose(id);
    }

    @Override
    public int update(GMModel gmModel) {
        return writeGMMapper.update(gmModel);
    }

    @Override
    public List<GMModel> findList() {
        return readGMMapper.findList();
    }

    @Override
    public GMModel findByName(String username) {
        return readGMMapper.findByName(username);
    }

    @Override
    public GMModel findById(Integer id) {
        return readGMMapper.findById(id);
    }

    @Override
    public int createLog(GMLogModel gmLogModel) {
        return writeGMLogMapper.insert(gmLogModel);
    }

    @Override
    public int recharge(OrderRecordModel model) {
        return writeOrderRecordMapper.insert(model);
    }


}
